import ShaderLib from "../ShaderLib";

export default class LoopCircleShader {
    public static getVertexShader() {
        return ShaderLib.getDefaultVertexShader();
    }

    public static getFragmentShader() {
        let shader = `
            #include <common>
            #include <fog_pars_fragment>
            #include <logdepthbuf_pars_fragment>
            varying vec2 uvTexcoord;
            uniform float radius;
            uniform float axis;
            uniform vec3 v_color;

            void main(){       
                vec2 uv = uvTexcoord;

                float radius = atan(uv.y - 0.5, uv.x - 0.5);
                float theta = radius * 180. / PI;
                
                if(theta < 0.){
                    theta = theta + 360.;
                }

                if ( theta > axis) {
                    discard;
                }    

                gl_FragColor= vec4(v_color, 1);
                #include <fog_fragment>
            }
        `;
        return shader;
    }

}
